-
-
Notifications
You must be signed in to change notification settings - Fork 819
path sep and windows related changes #9264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
also discussed |
|
@jedenastka do you have feedback about the contents of the plan? |
|
My concern is that it is AI generated. To me, this signals laziness and lack of thought, which is not something I want to see in a backup tool. A plan means you're actually planning something. If AI does it, it is not planning, because AI cannot think. Feel free to disagree. I do not plan to engage in further conversation. |
|
@jedenastka Well, I understand your concerns. I also have quite some concerns about AI usage, but (as so often), it depends on how you use it. The planning one can see here is the result of an hours long "discussion" between me and the AI, so maybe that was not what you meant with "lazy" and "lack of thought". It helped not to overlook aspects or places of the needed changes. Just wanted to clarify that. You don't need to reply if you do not have more specific feedback about the plan contents. |
|
wrt drive letters and extraction - how about storing the "extraction root" in the archive in a way that all items in a archive are relative paths to the extraction root this would come with some perks like backing up the same file tree in a different location would generate the same archive content including path names for all but the archive metadata wrt forbidden path names on windows - would using unc full paths work - i dislike schemes that may trigger a overlap - and statefull overlap prevention is unreasonably expensive in terms of implementation complexity |
|
@RonnyPfannschmidt one root would only be the simplest use case, but would not be enough for the general case. You can give multiple paths to borg as cli params or via the patterns file. You can even feed a list of arbitrary paths to borg. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9264 +/- ##
==========================================
+ Coverage 75.84% 75.86% +0.01%
==========================================
Files 86 86
Lines 14745 14753 +8
Branches 2194 2194
==========================================
+ Hits 11184 11193 +9
+ Misses 2888 2887 -1
Partials 673 673 ☔ View full report in Codecov by Sentry. |
6c1fa5f to
41d35ee
Compare
This commit implements a comprehensive approach to Windows path compatibility by standardizing on forward slashes (/) for all internal path representations while maintaining cross-platform archive compatibility. Core Strategy: - All internal paths now use forward slashes as separators on all platforms - Boundary normalization: backslashes converted to forward slashes at entry points on Windows (filesystem paths only, not user patterns) - Literal backslashes from POSIX archives replaced with % on Windows extraction Key Changes: Path Handling (helpers/fs.py): - Added slashify(): converts backslashes to forward slashes on Windows - Added percentify(): replaces backslashes with % for POSIX-to-Windows extraction - Updated make_path_safe() to check for Windows-style .. patterns - Changed get_strip_prefix() to use posixpath.normpath instead of os.path.normpath - Updated remove_dotdot_prefixes() to use forward slashes consistently Pattern Matching (patterns.py): - Replaced os.path with posixpath throughout for consistent separator handling - Updated PathFullPattern, PathPrefixPattern, FnmatchPattern, ShellPattern - All pattern matching now uses / as separator regardless of platform - Removed platform-specific os.sep usage Archive Operations (archive.py, item.pyx): - Applied slashify() to paths during archive creation on Windows - Added percentify/slashify encoding/decoding for symlink targets - Ensures archived paths always use forward slashes Command Line (archiver/create_cmd.py, extract_cmd.py): - Replaced os.path.join/normpath with posixpath equivalents - Added slashify() for stdin-provided paths on Windows - Updated strip_components to use / separator - Changed PathSpec to FilesystemPathSpec for proper path handling Repository (repository.py, legacyrepository.py): - Replaced custom _local_abspath_to_file_url() with Path.as_uri() Documentation (archiver/help_cmd.py): - Clarified that all archived paths use forward slashes - Added note about Windows absolute paths in archives (e.g., C/Windows/System32) - Documented backslash-to-percent replacement for POSIX archives on Windows Impact: - Windows users can now create and extract archives with consistent path handling - Cross-platform archives remain compatible - Pattern matching works identically on all platforms
e973962 to
8792a1c
Compare
Fixes #7120. Fixes #4731. Fixes #8474.
Also incorporated the changes from #9171, thanks to @valtron!